<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ADC: atomic Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ADC
   &#160;<span id="projectnumber">9.2</span>
   </div>
   <div id="projectbrief">Analog to Digital Conversor library for the Teensy 4 microprocessor</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('namespaceatomic.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">atomic Namespace Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Atomic set, clear, change, or get bit in a register.  
<a href="namespaceatomic.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae557d708b1629c90646e62be11ee7d1d"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ae557d708b1629c90646e62be11ee7d1d"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceatomic.html#ae557d708b1629c90646e62be11ee7d1d">setBitFlag</a> (volatile T &amp;reg, T flag)</td></tr>
<tr class="memdesc:ae557d708b1629c90646e62be11ee7d1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the bits in the flag for reg.  <a href="namespaceatomic.html#ae557d708b1629c90646e62be11ee7d1d">More...</a><br /></td></tr>
<tr class="separator:ae557d708b1629c90646e62be11ee7d1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a344bd9c9adab533a4620fcac8474f662"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a344bd9c9adab533a4620fcac8474f662"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceatomic.html#a344bd9c9adab533a4620fcac8474f662">clearBitFlag</a> (volatile T &amp;reg, T flag)</td></tr>
<tr class="memdesc:a344bd9c9adab533a4620fcac8474f662"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear the bits in the flag for reg.  <a href="namespaceatomic.html#a344bd9c9adab533a4620fcac8474f662">More...</a><br /></td></tr>
<tr class="separator:a344bd9c9adab533a4620fcac8474f662"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4633bac115d88ae414edb0900a805e3"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ae4633bac115d88ae414edb0900a805e3"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceatomic.html#ae4633bac115d88ae414edb0900a805e3">changeBitFlag</a> (volatile T &amp;reg, T flag, T state)</td></tr>
<tr class="memdesc:ae4633bac115d88ae414edb0900a805e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the bits in the flag for reg.  <a href="namespaceatomic.html#ae4633bac115d88ae414edb0900a805e3">More...</a><br /></td></tr>
<tr class="separator:ae4633bac115d88ae414edb0900a805e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a50fed210e64d35067f9c2c21cc44c441"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a50fed210e64d35067f9c2c21cc44c441"><td class="memTemplItemLeft" align="right" valign="top">volatile bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceatomic.html#a50fed210e64d35067f9c2c21cc44c441">getBitFlag</a> (volatile T &amp;reg, T flag)</td></tr>
<tr class="memdesc:a50fed210e64d35067f9c2c21cc44c441"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the bits in the flag for reg.  <a href="namespaceatomic.html#a50fed210e64d35067f9c2c21cc44c441">More...</a><br /></td></tr>
<tr class="separator:a50fed210e64d35067f9c2c21cc44c441"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Atomic set, clear, change, or get bit in a register. </p>
<p>Clear bit in address (make it zero), set bit (make it one), or return the value of that bit. <code>changeBitFlag</code> can change up to 2 bits in a flag at the same time</p>
<p>We can change this functions depending on the board:</p><ul>
<li>Teensy 3.x use bitband.</li>
<li>Teensy LC has a more advanced bit manipulation engine.</li>
<li>Teensy 4 also has bitband capabilities, but are not yet implemented, instead registers are set and cleared manually. TODO: fix this. </li>
</ul>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae4633bac115d88ae414edb0900a805e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae4633bac115d88ae414edb0900a805e3">&#9670;&nbsp;</a></span>changeBitFlag()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void atomic::changeBitFlag </td>
          <td>(</td>
          <td class="paramtype">volatile T &amp;&#160;</td>
          <td class="paramname"><em>reg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>flag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>state</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Change the bits in the flag for reg. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>Address type uint32_t, uint16_t, uint8_t, int32_t, int16_t </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">reg</td><td>Register in the bit-band area </td></tr>
    <tr><td class="paramname">flag</td><td>1 or 2 bit flag of reg to change </td></tr>
    <tr><td class="paramname">state</td><td>1 or 2 bit state </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="atomic_8h_source.html#l00227">227</a> of file <a class="el" href="atomic_8h_source.html">atomic.h</a>.</p>

</div>
</div>
<a id="a344bd9c9adab533a4620fcac8474f662"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a344bd9c9adab533a4620fcac8474f662">&#9670;&nbsp;</a></span>clearBitFlag()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void atomic::clearBitFlag </td>
          <td>(</td>
          <td class="paramtype">volatile T &amp;&#160;</td>
          <td class="paramname"><em>reg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>flag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Clear the bits in the flag for reg. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>Address type uint32_t, uint16_t, uint8_t, int32_t, int16_t </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">reg</td><td>Register in the bit-band area </td></tr>
    <tr><td class="paramname">flag</td><td>Mutibit flag of reg to clear </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="atomic_8h_source.html#l00212">212</a> of file <a class="el" href="atomic_8h_source.html">atomic.h</a>.</p>

</div>
</div>
<a id="a50fed210e64d35067f9c2c21cc44c441"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a50fed210e64d35067f9c2c21cc44c441">&#9670;&nbsp;</a></span>getBitFlag()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">volatile bool atomic::getBitFlag </td>
          <td>(</td>
          <td class="paramtype">volatile T &amp;&#160;</td>
          <td class="paramname"><em>reg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>flag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the bits in the flag for reg. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>Address type uint32_t, uint16_t, uint8_t, int32_t, int16_t </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">reg</td><td>Register in the bit-band area </td></tr>
    <tr><td class="paramname">flag</td><td>Mutibit flag of reg to get </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The state of the bits in flag in reg </dd></dl>

<p class="definition">Definition at line <a class="el" href="atomic_8h_source.html#l00261">261</a> of file <a class="el" href="atomic_8h_source.html">atomic.h</a>.</p>

</div>
</div>
<a id="ae557d708b1629c90646e62be11ee7d1d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae557d708b1629c90646e62be11ee7d1d">&#9670;&nbsp;</a></span>setBitFlag()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void atomic::setBitFlag </td>
          <td>(</td>
          <td class="paramtype">volatile T &amp;&#160;</td>
          <td class="paramname"><em>reg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T&#160;</td>
          <td class="paramname"><em>flag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the bits in the flag for reg. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>Address type uint32_t, uint16_t, uint8_t, int32_t, int16_t </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">reg</td><td>Register in the bit-band area </td></tr>
    <tr><td class="paramname">flag</td><td>Mutibit flag of reg to set </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="atomic_8h_source.html#l00199">199</a> of file <a class="el" href="atomic_8h_source.html">atomic.h</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespaceatomic.html">atomic</a></li>
    <li class="footer">Generated on Tue Nov 29 2022 23:16:43 for ADC by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
